Loading...
 

MATLAB implementation of the advection-diffusion with Galerkin method

Below you can find a link to the MATLAB code calculating the Galerkin advection-diffusion problem for the Eriksson-Johnson model problem.

Let us recall first the advection-diffusion problem, the Eriksson-Johnson model problem (described, for example, in [1]) defined on a square area \( \Omega = [0,1]^2 \) in the following way: We see \( u \) such as
\( a(u,v)=l(v) \forall v \) where
\( a(u,v) =\int_{\Omega} \beta_x(x,y) \frac{\partial u(x,y) }{\partial x } dxdy + \int_{\Omega} \beta_y(x,y) \frac{\partial u(x,y)}{\partial y } dxdy \\ +\epsilon \int_{\Omega} \frac{\partial u(x,y) }{\partial x} \frac{\partial v(x,y)}{\partial x } dxdy +\epsilon \int_{\Omega} \frac{\partial u(x,y)}{\partial y } \frac{\partial v(x,y)}{\partial y } dxdy \)
\( l(v) = \int_{\partial \Omega } f(x,y) v dxdy \)
\( f(x,y)=sin(\pi y)(1-x) \) is the extension of the Dirichlet boundary condition into the entire area, and
\( \beta = (1,0) \) represents the wind velocity blowing from the left side, and \( \epsilon = 10^{-2} \) denotes the diffusion coefficient. The quantity \( Pe=1/ \epsilon = 100 \) is called the Peclet number, and it defines the numerical sensitivity of the advection-diffusion problem. The definition of the Peclet number presented here is valid for unit wind speed \( \| \beta \|_2=\sqrt{\beta_x^2+\beta^2_y}=1 \). In the general case, the Peclet number defined on the individual grid elements according to the formula is considered
\( Pe=\| \beta \|_2*h/(2*\epsilon) \). The Peclet number defined in this way can be used to test the stability of the simulation, the Peclet number less than one gives us the condition for the stability of the simulation on the element.

In line 835 we create the knot vector with 5 elements for quadratic polynomials
\( knot = simple\_knot(5, 2); \)
In line 836, the diffusion coefficient is set (for an advection coefficient of 1).
\( epsilon = 2e-2; \)

The code execution is also possible in the free Octave(external link) environment.
Download code(external link) or see ( Appendix 3A ).

The code is run by opening it in Octave and typing a command
\( advection' \).
After a moment of calculation, the code opens an additional window and draws a numerical and exact solution to it.
The code also computes the norm L2 and H1 from the solution
\( Error: L2 24.00 procent, H1 72.08 procent \)
and compares it to the L2 and H1 standards from the projection of the exact solution onto the space of B-spline functions spanning a given grid. \( Best possible: L2 1.56 procent, H1 53.16 procent \)
Note that this norm will not be equal to zero, because the exact solution is not given by the B-spline functions, and even if we know the exact solution, it is not given by the B-spline functions, and its projection on the B-spline function space is also an approximation of the exact solution.

Content of exercise:
Please modify the advection-diffusion code (for the diffusion coefficient of 0.02), so that it uses B-spline polynomials of the second degree spanning the interval \( 2^k \) elements. What k should be used to get the exact solution? Why?
Content of exercise:
Please modify the advection-diffusion code so that Pe = 1,000,000, and try to solve it with the Galerkin method for 64 elements and square B-spline functions.

Exercise 3: Adaptive increase of apox machine and test mesh by breaking in half the element closest to the singularity for a large value of Pecklet number

Content of exercise:
Please modify the problem so that the Peclet number is one million. Please start from the grid [0 0.5 1] in the x direction and [0 0.25 0.5 0.75 1] in the y direction, and increase adaptively the number of points towards the right edge where the boundary layer is, keeping the degrees of B-spline polynomials in the approximation space and testing. Please check how this operation improves the accuracy of the solution.

Ostatnio zmieniona Wtorek 09 z Listopad, 2021 12:35:18 UTC Autor: Maciej Paszynski
Zaloguj się/Zarejestruj w OPEN AGH e-podręczniki
Czy masz już hasło?

Hasło powinno mieć przynajmniej 8 znaków, litery i cyfry oraz co najmniej jeden znak specjalny.

Przypominanie hasła

Wprowadź swój adres e-mail, abyśmy mogli przesłać Ci informację o nowym haśle.
Dziękujemy za rejestrację!
Na wskazany w rejestracji adres został wysłany e-mail z linkiem aktywacyjnym.
Wprowadzone hasło/login są błędne.